using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MimeCloud.AssetManagement.Silverlight.MediaLibrary.AssetManagerDataServiceReference;
using MimeCloud.AssetManagement.Silverlight.DataServiceConsumer.AssetManagerDataServiceReference;

namespace MimeCloud.AssetManagement.Silverlight.MediaLibrary
{
    public partial class Page : UserControl
    {
        public Page()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(Page_Loaded);
            
        }

        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            AssetManagerEntities f = new AssetManagerEntities(new Uri("http://localhost:53060/AssetManagerDataService.svc"));

            var dsQuery = (DataServiceQuery<Asset>)from ast in f.Assets select ast;
            dsQuery.BeginExecute(
                result =>  lstCustomers.ItemsSource = dsQuery.EndExecute(result), null
                );
            
        }
    }
}
